package Experiment6;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
public class TestMemos {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        ArrayList<Memo> box = new ArrayList<>();
//        MemoManager.ReadMemos(box,"Memo");
        int select;
        do {
            System.out.println("欢迎使用备忘录");
            System.out.println("   1.ADD");
            System.out.println("   2.Check");
            System.out.println("   3.Exit");
            select = input.nextInt();
            switch (select)
            {
                case 1:
                    input.nextLine();
                    System.out.println("请输入标题");
                    String topic = input.nextLine();
                    System.out.println("请输入内容");
                    String message = input.nextLine();
                    box.add(new Memo(topic,message));
                    break;
                case 2:
                    Iterator<Memo> i = box.iterator();
                    while(i.hasNext()){
                        System.out.println(i.next());
                    }
                    break;
                case 3:
                    break;
            }
        }while(select!=3);
        System.out.println("请输入想要存储的文件名");
        String filename = input.next();
        MemoManager.SaveMemos(box,filename);
        System.out.println("保存成功");
    }
}
